package com.flower.controller;

import com.flower.domain.ApiResult;
import com.flower.domain.entity.BackageUser;
import com.flower.service.AuthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/auth")
@Slf4j
/**
 * 用户认证控制层
 * @author lixinghe
 * @since 2022-10-09
 */
public class AuthController {

    @Resource
    private AuthService authService;

    @PostMapping("/login")
    public ApiResult<Map<String,Object>> login(@RequestBody BackageUser user){
        return authService.login(user);
    }


    @GetMapping("/logout")
    public ApiResult<Boolean> logout(){
        return authService.logout();
    }
}
